import java.util.Scanner;

public class Forth {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("长字符串");
        String max = sc.next();
        System.out.println("短字符串");
        String min = sc.next();
        String target = null;
        if(min.equals(max))System.out.println(max);
        for(int i = min.length(); i > 0; i--) {
            for(int j = 0; j < min.length() - i + 1; j++) {
                target = min.substring(j, j + i);
                if(max.contains(target)) {
                    System.out.println(target);
                    return;
                }
            }
        }
        //循环结束则没有相同字串
        System.out.println("no identical consecutive string");
        return;
    }
}
